<?php
 include_once "../lib/DAL/ToChucPhongThi.php";
 
 class ToChucPhongThiBLL{
     function __construct(){
       
    }
    
    function __destruct(){
        
    }
    
    public function getTCPhongThiInfo($ma_tochucphongthi){
        $sql="select * from tbl_tochucphongthi where ma_tochucphongthi = '".$ma_tochucphongthi."'";
        $result =mysql_fetch_array( mysql_query($sql) or die(mysql_error()));
        $this->setTCPhongThiBLL($result);
    }
    
    public function getListTCPhongThi(){
        $sql ="select * from tbl_tochucphongthi";
        $result = mysql_query($sql) or die(mysql_error());
        $arr_TcPhongThi = array();
        
        while($row = mysql_fetch_array($result)){
            $arr_TcPhongThi[] = $this->setTCPhongThiBLL($row);
        }
        return $arr_TcPhongThi;
        
    }
    
    public function insertTcPhongThi($TcPhongThi){
        $sql="INSERT INTO tuxa2.tbl_tochucphongthi(
           ma_tochucphongthi
          ,sophong
          ,giamthi1
          ,giamthi2
            ) VALUES (
               '".$TcPhongThi->getma_tochucphongthi()."'
              ,".$TcPhongThi->getso_phong()."
              ,'".$TcPhongThi->getgiamthi1()."'  
              ,'".$TcPhongThi->getgiamthi2()."' 
            )";
    }
    function setTCPhongThiBLL($row){
        $TcPhongThi = new ToChucPhongThi();
        $TcPhongThi->setTCPhongThi($row['sophong'],$row['ma_tochucphongthi'] ,$row['giamthi1'] ,$row['giamthi2'] );
        return $TcPhongThi;
    }
 }

?>